package com.huawei.hianalytics.hms;

import android.content.Context;
import com.huawei.hianalytics.ab.fg.ab;
import com.huawei.hianalytics.ab.fg.cd;
import java.util.LinkedHashMap;

public abstract class HiAnalytics {
    private static cd defaultInstance = null;

    public static void clearCachedData() {
        ab.ab().bc();
    }

    private static synchronized cd getDefaultInstance() {
        cd cdVar;
        synchronized (HiAnalytics.class) {
            if (defaultInstance == null) {
                defaultInstance = ab.ab().bc();
            }
            cdVar = defaultInstance;
        }
        return cdVar;
    }

    public static boolean getInitFlag() {
        return ab.ab().cd();
    }

    public static void onEvent(int i, String str, LinkedHashMap<String, String> linkedHashMap) {
        if (getDefaultInstance() == null) {
            return;
        }
        if (i == 1 || i == 0) {
            defaultInstance.ab(i, str, (LinkedHashMap) linkedHashMap);
        } else {
            com.huawei.hianalytics.ab.bc.ef.ab.bc("hmsSdk", "Data type no longer collects range.type: " + i);
        }
    }

    @Deprecated
    public static void onEvent(Context context, String str, String str2) {
        if (getDefaultInstance() != null) {
            defaultInstance.ab(context, str, str2);
        }
    }

    public static void onEvent(String str, LinkedHashMap<String, String> linkedHashMap) {
        if (getDefaultInstance() != null) {
            defaultInstance.ab(0, str, (LinkedHashMap) linkedHashMap);
        }
    }

    public static void onPause(Context context) {
        if (getDefaultInstance() != null) {
            defaultInstance.ab(context);
        }
    }

    public static void onPause(Context context, LinkedHashMap<String, String> linkedHashMap) {
        if (getDefaultInstance() != null) {
            defaultInstance.ab(context, (LinkedHashMap) linkedHashMap);
        }
    }

    public static void onPause(String str, LinkedHashMap<String, String> linkedHashMap) {
        if (getDefaultInstance() != null) {
            defaultInstance.ab(str, (LinkedHashMap) linkedHashMap);
        }
    }

    public static void onReport() {
        if (getDefaultInstance() != null) {
            defaultInstance.ab(-1);
        }
    }

    @Deprecated
    public static void onReport(Context context) {
        if (getDefaultInstance() != null) {
            defaultInstance.ab(context, -1);
        }
    }

    public static void onResume(Context context) {
        if (getDefaultInstance() != null) {
            defaultInstance.bc(context);
        }
    }

    public static void onResume(Context context, LinkedHashMap<String, String> linkedHashMap) {
        if (getDefaultInstance() != null) {
            defaultInstance.bc(context, (LinkedHashMap) linkedHashMap);
        }
    }

    public static void onResume(String str, LinkedHashMap<String, String> linkedHashMap) {
        if (getDefaultInstance() != null) {
            defaultInstance.bc(str, (LinkedHashMap) linkedHashMap);
        }
    }

    public static void onStreamEvent(int i, String str, LinkedHashMap<String, String> linkedHashMap) {
        if (getDefaultInstance() == null) {
            return;
        }
        if (i == 1 || i == 0) {
            defaultInstance.bc(i, str, linkedHashMap);
        } else {
            com.huawei.hianalytics.ab.bc.ef.ab.bc("hmsSdk", "Data type no longer collects range.type: " + i);
        }
    }

    public static void setIsOaidTracking(boolean z) {
        if (getDefaultInstance() != null) {
            defaultInstance.ab(1, z);
            defaultInstance.ab(0, z);
        }
    }

    public static void setOAID(String str) {
        if (getDefaultInstance() != null) {
            defaultInstance.bc(1, str);
            defaultInstance.bc(0, str);
        }
    }

    public static void setUPID(String str) {
        if (getDefaultInstance() != null) {
            defaultInstance.ab(1, str);
            defaultInstance.ab(0, str);
        }
    }
}
